import os
import random
from utils.mysqlUtils.db_utils import DB
from testcases.Listing_migration.Data_Migration.test_public_way import public_invoking


def get_hundred_ordersourceid(count):
    filePath = os.path.abspath("../../../config/config.yaml")
    sql = f"select OrderSourceId from aml_department_ordersource"
    cold_base = DB(filePath,"mysql_db_code_base")
    cold_res = cold_base.execute_sql_many(sql=sql)
    if count == 'all':
        OrderSourceID = []
        for i in cold_res:
            OrderSourceID.append(i["OrderSourceId"])
        return OrderSourceID
    else:
        random_num = random.sample(cold_res,count)
        OrderSourceID = []
        for i in random_num:
            OrderSourceID.append(i["OrderSourceId"])
        return OrderSourceID

def test(err_list,data):
    err_list.append(data)

if __name__ == '__main__':
    res = get_hundred_ordersourceid('all')
    # print(len(res))